package com.jiuyou.clientController.opinion;

import com.jiuyou.clientController.base.ClientBaseController;
import com.ruoyi.common.constant.DicConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.opinion.domain.Opinion;
import com.ruoyi.opinion.service.IOpinionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 意见反馈
 *
 * @author jiuyou
 */
@RestController
@RequestMapping("/client/opinion")
public class OpinionClientController extends ClientBaseController
{
    private static final Logger log = LoggerFactory.getLogger(OpinionClientController.class);
    @Autowired
    private IOpinionService opinionService;

    @PutMapping
    public boolean create(@RequestBody Opinion opinion){
        try{
            Long loginMemberId = getLoginMemberId();
            opinion.setSubUserId(loginMemberId);
            opinion.setOpinionType(DicConstants.BUSINESS_Customer.getCode());
            opinionService.insertOpinion(opinion);
            return true;
        }catch (Exception e){
            return false;
        }
    }
}
